﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace Qianwei.Web.Common
{
    public class DataPaging<T>
    {
        public static IList<T> GetDataSource(Wuqi.Webdiyer.AspNetPager pager, IList<T> olist)
        {
            pager.RecordCount = olist.Count;
            if (olist.Count == 0)
            {
                return olist;
            }
            else
            {
                int startIndex = (pager.CurrentPageIndex - 1) * pager.PageSize;//开始行；
                var newlist = olist.Skip(startIndex).Take(pager.PageSize);
                return newlist.ToList<T>();
            }
        }
    }
}